package net.myjung.maven;

import java.util.ArrayList;
import java.util.List;

import net.myjung.model.BaseObject;
import net.myjung.model.annotation.MdlAttribute;
import net.myjung.model.annotation.MdlClass;
import net.myjung.model.annotation.MdlElement;

@MdlClass(name = "Project")
@SuppressWarnings("serial")
public class MvnProject extends BaseObject {
	@MdlAttribute(type = "string")
	private String xmlns;
	@MdlAttribute(name = "xmlns:xsi", type = "string")
	private String xmlns_xsi;
	@MdlAttribute(name = "xsi:schemaLocation", type = "string")
	private String xsi_schemaLocation;
	@MdlElement(type = "string")
	private String modelVersion;
	@MdlElement(type = "string")
	private String groupId;
	@MdlElement(type = "string")
	private String artifactId;
	@MdlElement(type = "string")
	private String packaging;
	@MdlElement(type = "string")
	private String version;
	@MdlElement(type = "net.myjung.maven.Build")
	private MvnBuild build;
	@MdlElement(singular = "profile", type = "net.myjung.maven.Profile")
	private List<MvnProfile> profiles;
	@MdlElement(singular = "repository", type = "net.myjung.maven.Repository")
	private List<MvnRepository> repositories;
	@MdlElement(singular = "pluginRepository", type = "net.myjung.maven.Repository")
	private List<MvnRepository> pluginRepositories;
	@MdlElement(singular = "dependency", type = "net.myjung.maven.Dependency")
	private List<MvnDependency> dependencies;

	public MvnProject() {
		super();
		xmlns = "http://maven.apache.org/POM/4.0.0";
		xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance";
		xsi_schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";
		modelVersion = "4.0.0";
		packaging = "jar";
		version = "0.0.1";
	}

	public String getXmlns() {
		return xmlns;
	}
	public void setXmlns(String xmlns) {
		this.xmlns = xmlns;
	}
	public String getXmlns_xsi() {
		return xmlns_xsi;
	}
	public void setXmlns_xsi(String xmlns_xsi) {
		this.xmlns_xsi = xmlns_xsi;
	}
	public String getXsi_schemaLocation() {
		return xsi_schemaLocation;
	}
	public void setXsi_schemaLocation(String xsi_schemaLocation) {
		this.xsi_schemaLocation = xsi_schemaLocation;
	}
	public String getModelVersion() {
		return modelVersion;
	}
	public void setModelVersion(String modelVersion) {
		this.modelVersion = modelVersion;
	}
	public String getGroupId() {
		return groupId;
	}
	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}
	public String getArtifactId() {
		return artifactId;
	}
	public void setArtifactId(String artifactId) {
		this.artifactId = artifactId;
	}
	public String getPackaging() {
		return packaging;
	}
	public void setPackaging(String packaging) {
		this.packaging = packaging;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public MvnBuild getBuild() {
		return build;
	}
	public void setBuild(MvnBuild build) {
		this.build = build;
	}
	public List<MvnProfile> getProfiles() {
		return profiles;
	}
	public void setProfiles(List<MvnProfile> profiles) {
		this.profiles = profiles;
	}
	public void addProfile(MvnProfile profile) {
		if (this.profiles == null)
			this.profiles = new ArrayList<MvnProfile>();
		this.profiles.add(profile);
	}
	public void removeProfile(MvnProfile profile) {
		if (this.profiles == null || !this.profiles.contains(profile))
			return;
		this.profiles.remove(profile);
	}
	public List<MvnRepository> getRepositories() {
		return repositories;
	}
	public void setRepositories(List<MvnRepository> repositories) {
		this.repositories = repositories;
	}
	public void addRepository(MvnRepository repository) {
		if (this.repositories == null)
			this.repositories = new ArrayList<MvnRepository>();
		this.repositories.add(repository);
	}
	public void removeRepository(MvnRepository repository) {
		if (this.repositories == null || !this.repositories.contains(repository))
			return;
		this.repositories.remove(repository);
	}
	public List<MvnRepository> getPluginRepositories() {
		return pluginRepositories;
	}
	public void setPluginRepositories(List<MvnRepository> pluginRepositories) {
		this.pluginRepositories = pluginRepositories;
	}
	public void addPluginRepository(MvnRepository pluginRepository) {
		if (this.pluginRepositories == null)
			this.pluginRepositories = new ArrayList<MvnRepository>();
		this.pluginRepositories.add(pluginRepository);
	}
	public void removePluginRepository(MvnRepository pluginRepository) {
		if (this.pluginRepositories == null || !this.pluginRepositories.contains(pluginRepository))
			return;
		this.pluginRepositories.remove(pluginRepository);
	}
	public List<MvnDependency> getDependencies() {
		return dependencies;
	}
	public void setDependencies(List<MvnDependency> dependencies) {
		this.dependencies = dependencies;
	}
	public void addDependency(MvnDependency dependency) {
		if (this.dependencies == null)
			this.dependencies = new ArrayList<MvnDependency>();
		this.dependencies.add(dependency);
	}
	public void removeDependency(MvnDependency dependency) {
		if (this.dependencies == null || !this.dependencies.contains(dependency))
			return;
		this.dependencies.remove(dependency);
	}
}